package cn.com.blueInfo.bpm.template.enums;

import cn.com.blueInfo.bpm.common.enums.BaseEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 事件类型
 * @author suxch
 * @since 2025/8/28 22:38
 */
@Getter
@AllArgsConstructor
public enum EventType implements BaseEnum<String> {

    /** 事件类型-定时事件 */
    TIMER("TIMER", "定时事件"),
    /** 事件类型-状态变更事件 */
    STATUS_CHANGE("STATUS_CHANGE", "状态变更事件"),
    /** 事件类型-信号事件 */
    SIGNAL("SIGNAL", "信号事件");

    @EnumValue
    private final String code;

    @JsonValue
    private final String desc;

    public static EventType getByCode(String code) {
        return BaseEnum.getByCode(EventType.class, code);
    }

    @JsonCreator
    public static EventType getByName(String name) {
        return BaseEnum.getByName(name, EventType.class);
    }

}
